<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			// 1.求1+2+...100=和;
				var num=1;
				var sum=0;
				while (num<=100){
					sum += num;
					num++;
				}
				console.log(sum);
			// 2.求1-100之间,既是3的倍数又是5的倍数;
				var num1=1;
				while (num1<= 100){
					if (num1%3==0 && num1%5==0){
						console.log(num1);
					}
					num1++;
				}
			 // 3.求以下的值0+5,1+4,2+3,3+2,4+1,5+0
				for(var num2=0;num2<=5;num2++){
					console.log(num2,"+",(5-num2));
					console.log(num2+(5-num2));
				}
			 // 4.求2,-4,6,-8....n,求第n个值是多少?
				for(var i=1;i<=8;i++){
					if(n%2==0){
						console.log(-2*i);
					}else{
						console.log(2*i);
					}
				}
		</script>
	</body>
</html>
